# coding=utf-8
import requests
from Exploits import printModule


r = '\033[31m'
g = '\033[32m'
y = '\033[33m'
b = '\033[34m'
m = '\033[35m'
c = '\033[36m'
w = '\033[37m'
Headers = {
        "User-Agent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) "
                      "AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50"
    }

def Exploit(site):
    try:
        cH = requests.get('http://{}/wp-admin/setup-config.php'.format(site), timeout=7, headers=Headers)
        if '<form id="setup" method="post" action="?step=0"' in str(cH.content):
            with open('result/wp-install.txt', 'a') as writer:
                writer.write('{}/wp-admin/setup-config.php\n'.format(site))
            return printModule.returnYes(site, 'N/A', 'Wp-Install', 'Wordpress')
        else:
            return printModule.returnNo(site, 'N/A', 'Wp-Install', 'Wordpress')
    except:
        return printModule.returnNo(site, 'N/A', 'Wp-Install', 'Wordpress')
